home *** CD-ROM | disk | FTP | other *** search
- TABLE OF CONTENTS
-
- pciexpansion.library/--background--
- pciexpansion.library/AddPCIDev
- pciexpansion.library/AllocPCIDev
- pciexpansion.library/FindPCIDev
- pciexpansion.library/FreePCIDev
- pciexpansion.library/GetPCIReg
- pciexpansion.library/PutPCIReg
- pciexpansion.library/RemPCIDev
-
- pciexpansion.library/--background-- pciexpansion.library/--background--
-
-
- PURPOSE
- pciexpansion.library is module responsible for integrating
- PCI cards with Amiga system. During initialization this library
- scans PCI slots. Each detected PCI card is configured (PCI) and
- defined in AmigaOS expansion.library. PCI configuration settings
- are stored in pciexpansion.library's private list.
-
- PCI Configuration Registers (shown as a structure)
-
- /* pci card configuration header format */
- /* Can be accessed by Get/PutPCIReg (RW) */
- /* or via FindPCIDev (RO) */
- struct PCICfg {
- /* offset 0x0 */
- struct pci_id {
- ULONG did : 16; /* Device ID. */
- ULONG vid : 16; /* Vendor ID. 0xFFFF - slot empty */
- } pcie_id;
- /* offset 0x4 */
- struct pci_cs {
- ULONG d_pe : 1; /* Detected Parity Error. */
- ULONG s_serr : 1; /* Signaled SERR#. */
- ULONG r_ma : 1; /* Received Master-Abort. */
- ULONG r_ta : 1; /* Received Target-Abort. */
- ULONG s_ta : 1; /* Signaled Target-Abort. */
- ULONG devsel : 2; /* DEVSEL timing. */
- ULONG dp_d : 1; /* Data Parity Detected. */
- ULONG tfbbc : 1; /* Target Fast Back to Back */
- /* Capable. */
- ULONG udfs : 1; /* User Definable Features */
- /* Support. */
- ULONG dev66 : 1; /* Device 66 MHz Capable. */
- ULONG res1 : 5; /* PCI Reserved. */
- ULONG res2 : 6; /* PCI Reserved. */
- ULONG mfbbc : 1; /* Master Fast Back-to-Back */
- /* Enable. */
- ULONG serr_en : 1; /* SERR# Enable. */
- ULONG step : 1; /* Data/address stepping. */
- ULONG peresp : 1; /* Parity Error Response. */
- ULONG vgaps : 1; /* VGA Palette Snoop. */
- ULONG mwi_en : 1; /* Memory Write and Invalidate */
- /* Enable. */
- ULONG sca : 1; /* Special Cycles action. */
- ULONG bm : 1; /* Bus Master. */
- ULONG ms : 1; /* Memory Space. */
- ULONG ios : 1; /* I/O Space. */
- } pcie_cs;
- /* offset 0x8 */
- struct pci_class {
- ULONG base : 8; /* Base Class Code. */
- ULONG sub : 8; /* Sub Class Code. */
- ULONG prog : 8; /* Programming Interface. */
- ULONG revid : 8; /* Revision ID. */
- } pcie_class;
- /* offset 0xC */
- struct pci_misc0 {
- ULONG bistc : 1; /* BIST Capable. */
- ULONG sbist : 1; /* Start BIST. */
- ULONG res1 : 2; /* PCI Reserved. */
- ULONG ccode : 4; /* Completion Code. */
- ULONG mfunct : 1; /* Multifunction Device. */
- ULONG layout : 7; /* Configuration Space Layout. */
- ULONG ltimer : 5; /* Latency Timer. */
- ULONG zero1 : 7; /* Zeros. */
- ULONG cline : 2; /* CacheLine Size. */
- ULONG zero2 : 2; /* Zeros. */
- } pcie_misc0;
- /* offsets 0x10 - 0x24 */
- /* base address registers - bit 0 selects space */
- /* 1 - IO space, 0 - memory space */
- /* all unused bits are hardwired to 0 */
- /* to determine board size write all 1's */
- /* and read. All used address line will be 1's */
- /* Most significant 0's determines board size */
- union pci_base_address {
- struct pci_mem_addr {
- ULONG ba : 28; /* Base Address. */
- ULONG pref : 1; /* Prefetchable */
- ULONG type : 2; /* 00 - locate anywhere in 32bit */
- /* space */
- /* 01 - locate below 1MB */
- /* 10 - locate anywhare in 64bit */
- /* space */
- /* 11 - reserved */
- ULONG space : 1; /* PCI Bus Address Space. */
- /* 0 - memory space */
- } pcie_mem_addr;
- struct pci_io_addr {
- ULONG ba : 30; /* Base Address. */
- ULONG zero1 : 1; /* Zeros. */
- ULONG space : 1; /* PCI Bus Address Space. */
- /* 1 - IO space */
- } pcie_io_addr;
- ULONG valUlong; /* if you prefer to mask bits */
- } pcie_baddr[6]; /* up to 6 address registers */
- /* offset 0x28 */
- ULONG pcie_CISptr; /* Cardbus CIS pointer */
- /* offset 0x2c */
- struct pci_sid {
- ULONG sid : 16; /* Subsystem ID. */
- ULONG svid : 16; /* Subsystem Vendor ID. */
- } pcie_sid;
- /* offset 0x30 */
- /* ROM base address - bit 0 enables ROM support */
- union pci_rom_addr
- struct {
- ULONG ba : 21; /* Base Address. */
- ULONG zero1 : 10; /* Zeros. */
- ULONG ena : 1; /* ROM enable */
- } bits;
- ULONG valUlong;
- } pcie_rom_addr;
- /* offset 0x34 */
- ULONG pci_Reserved1;
- /* offset 0x38 */
- ULONG pci_Reserved2;
- /* offset 0x3c */
- struct pci_misc1 {
- ULONG max_lat : 8; /* Maximum Latency. */
- ULONG min_gnt : 8; /* Minimum Grant. */
- ULONG int_pin : 8; /* Interrupt Pin. */
- ULONG int_line : 8; /* Interrupt Line. */
- } pcie_misc1;
- };
-
- Structure PCIConfDev
- This structure is used by pciexpansion.library to hold
- PCI configuration information and link this information
- with expansion.library Zorro information.
-
- struct PCIConfDev {
- struct Node DevNode; /* list pointers */
- struct PCICfg Config; /* PCI information */
- UBYTE bitsizes[6]; /* see micronik_pci.resource */
- UBYTE ROMbitsize;
- struct ConfigDev * ExpansionDev; /* link with expansion.library */
- struct PCIExpDev * next;
- UBYTE SlotNo; /* PCI slot number */
- };
-
- Cooperation with expansion.library
-
- Each PCI card is defined in system using expansion.library
- AddConfigDev function. Unless card has a ROM-based driver, it is
- defined with cd_Manufacturer = 3855 (Micronik) and
- cd_Product = 149 (unrecognized PCI card). Other ProductID used
- by PCI software/hardware are:
-
- 147 - PCI window
- 148 - PCI bridge registers.
-
- If PCI card has a ROM with Amiga specific driver (image), both
- cd_Manufacturer and cd_Product can be defined in this ROM.
- (feature not implemented yet)
-
-
- -------
- pciexpansion.library/AddPCIDev pciexpansion.library/AddPCIDev
-
- NAME
- AddPCIDev - add a new PCIConfDev structure to the
- pciexpansion.library list.
-
- SYNOPSIS
- AddPCIDev( PCIConfDev )
- A0
-
- FUNCTION
- (Not typically called by user code)
-
- This routine adds the specified PCIConfDev structure to the
- list of PCI Devices in the system.
-
- INPUTS
- configDev - a valid PCIConfDev structure.
-
- RESULTS
-
- EXCEPTIONS
-
- SEE ALSO
- RemPCIDev
-
- BUGS
-
-
- pciexpansion.library/AllocPCIDev pciexpansion.library/AllocPCIDev
-
- NAME
- AllocConfigDev - allocate a PCIConfDev structure
-
- SYNOPSIS
- PCIconfDev = AllocPCIDev()
- D0
-
- FUNCTION
- This routine returns the address of a PCIConfDev structure.
- It is provided so new fields can be added to the structure
- without breaking old, existing code. The structure is cleared
- when it is returned to the user.
-
- INPUTS
-
- RESULTS
- PCIconfDev - either a valid PCIConfDev structure or NULL.
-
- EXCEPTIONS
-
- SEE ALSO
- FreePCIDev
-
- BUGS
-
-
- pciexpansion.library/FindPCIDev pciexpansion.library/FindPCIDev
-
- NAME
- FindPCIDev - find a matching PCIConfDev entry
-
- SYNOPSIS
- PCIConfDev = FindPCIDev( start, selection )
- D0 A0 A1
-
- struct PCIConfDev * FindPCIDev(struct PCIConfDev *, struct Tagitem *)
-
- FUNCTION
- This routine searches the list of existing PCIConfDev
- structures in the system and looks for one that matches
- specified selection parameters. You can specify any
- number of parameters - returned structure matches
- all of them.
-
- If the start is NULL the the search is from the
- start of the list of configuration devices. If it is
- not null then it searches from the first configuration
- device entry AFTER start.
-
- INPUTS
- start - a valid PCIConfDev structure, or NULL to start
- from the start of the list.
- selection - (optional) array of TagItem structures with
- parameters/value pairs.
-
- RESULTS
- PCIConfDev - the next PCIConfDev entry that matches the
- specified parameters, or NULL if there
- are no more matches.
-
- EXAMPLES
- struct TagItem pcitags[] =
- {
- {PCIE_VENDORID, 0x5333}, /* S3 Incorporated */
- {PCIE_BASECLASSCODE, 0x3}, /* Gfx card */
- {TAG_DONE, 0 }
- };
-
- /* to find all configdevs of the proper type */
- struct PCIConfDev *pcd = NULL;
-
- /* for all Gfx cards made by S3 Incorporated */
- while( pcd = FindConfigDev( pcd, tags ) ) {
- /* do something with the returned PCIConfDev */
- }
-
- SEE ALSO
-
- BUGS
-
-
- pciexpansion.library/FreePCIDev pciexpansion.library/FreePCIDev
-
- NAME
- FreePCIDev - free a PCIConfDev structure
-
- SYNOPSIS
- FreePCIDev( PCIconfDev )
- A1
-
- FUNCTION
- This routine frees a PCIConfDev structure as returned by
- AllocPCIDev.
-
- INPUTS
- PCIconfDev - a valid PCIConfDev structure.
-
- RESULTS
-
- EXCEPTIONS
-
- SEE ALSO
- AllocPCIDev
-
- BUGS
-
-
- pciexpansion.library/GetPCIReg pciexpansion.library/GetPCIReg
-
- NAME
- GetPCIReg - Read PCI configuration register.
-
- SYNOPSIS
- value = GetPCIReg( board, offset )
- D0 A0 D0
-
- ULONG GetPCIReg(struct PCIConfDev, UBYTE)
-
- FUNCTION
- This function is higher level version of micronik_pci.resource
- ReadCfgReg function. GetPCIReg function updates all
- information in pciexpansion.library structures.
- You need to specify PCIConfBoard pointer instead of
- slot number.
-
- INPUTS
- board - a pointer to the valid PCIConfDev structure.
- offset - a logical offset of configuration register
-
- RESULTS
- value - the configuration register value.
-
-
- SEE ALSO
- PutPCIReg, micronik_pci.resource/ReadCfgReg
-
-
- pciexpansion.library/PutPCIReg pciexpansion.library/PutPCIReg
-
- NAME
- PutPCIReg - Write PCI configuration register.
-
- SYNOPSIS
- PutPCIReg( board, offset, value )
- A0 D0 D1
-
- PutPCIReg(struct PCIConfDev *, UBYTE, ULONG)
-
- FUNCTION
- PutPCIReg writes a new value to a PCI configuration register of
- specified PCI card. This function also updares information
- stored in pciexpansion.library structures.
- You need to specify PCIConfBoard pointer instead of
- slot number.
-
- INPUTS
- board - a pointer to the valid PCIConfDev structure.
- offset - a logical offset of configuration register
- value - the data to be written to the configuration
- register
-
- SEE ALSO
- GetPCIReg, micronik_pci.resource/WriteCfgReg
-
-
- pciexpansion.library/RemPCIDev pciexpansion.library/RemPCIDev
-
- NAME
- RemPCIDev - remove a PCIConfDev structure from the system
-
- SYNOPSIS
- RemConfigDev( PCIconfDev )
- A0
-
- FUNCTION
- (Not typically called by user code)
-
- This routine removes the specified PCIConfDev structure from the
- list of PCI Devices in the system.
-
- INPUTS
- PCIconfDev - a valid PCIConfDev structure.
-
- RESULTS
-
- EXCEPTIONS
-
- SEE ALSO
- AddPCIDev
-
- BUGS
-
-
-